package org.gdstash.ui.character;

import org.gdstash.character.GDChar;
import org.gdstash.ui.GDStashFrame;
import org.gdstash.ui.select.IntLenDocFilter;
import org.gdstash.ui.util.AdjustablePanel;
import org.gdstash.util.GDImagePool;
import org.gdstash.util.GDMsgFormatter;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.text.AbstractDocument;
import javax.swing.text.DocumentFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class GDCharStatAchievementPane extends AdjustablePanel {
    private JLabel lblGreatestDamageDealt;
    private JLabel lblGreatestDamageTaken;
    private JLabel lblMonstersKilled;
    private JLabel lblHeroesKilled;
    private JLabel lblNemesisKilled;
    private JLabel lblNotesCollected;
    private JLabel lblOneshotsOpened;
    private JLabel lblPlayTime;
    private JLabel lblItemsCrafted;
    private JLabel lblRelicsCrafted;
    private JLabel lblRelicsTransCrafted;
    private JLabel lblRelicsMythicalCrafted;
    private JTextField ftGreatestDamageDealt;
    private JTextField ftGreatestDamageTaken;
    private JTextField ftMonstersKilled;
    private JTextField ftHeroesKilled;
    private JTextField ftNemesisKilled;
    private JTextField ftNotesCollected;
    private JTextField ftOneshotsOpened;
    private JTextField ftPlayTime;
    private JTextField ftItemsCrafted;
    private JTextField ftRelicsCrafted;
    private JTextField ftRelicsTransCrafted;
    private JTextField ftRelicsMythicalCrafted;
    private JButton btnGreatestDamageDealtReset;
    private JButton btnGreatestDamageTakenReset;
    private GDChar gdc;

    public GDCharStatAchievementPane() {
        this.adjustUI();
        final JPanel pnlLeft = this.buildLeftSidePanel();
        final JPanel pnlRight = this.buildRightSidePanel();
        GroupLayout layout = null;
        GroupLayout.SequentialGroup hGroup = null;
        GroupLayout.SequentialGroup vGroup = null;
        layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setAutoCreateGaps(true);
        layout.setAutoCreateContainerGaps(true);
        hGroup = layout.createSequentialGroup();
        hGroup.addGroup(layout.createParallelGroup().addComponent(pnlLeft)).addGroup(layout.createParallelGroup().addComponent(pnlRight));
        layout.setHorizontalGroup(hGroup);
        vGroup = layout.createSequentialGroup();
        vGroup.addGroup(layout.createParallelGroup().addComponent(pnlLeft).addComponent(pnlRight));
        layout.setVerticalGroup(vGroup);
        layout.linkSize(0, pnlLeft, pnlRight);
    }

    @Override
    public void adjustUI() {
        Font fntLabel = UIManager.getDefaults().getFont("Label.font");
        Font fntButton = UIManager.getDefaults().getFont("Button.font");
        if (fntButton == null) {
            fntButton = fntLabel;
        }
        Font fntFText = UIManager.getDefaults().getFont("FormattedTextField.font");
        if (fntFText == null) {
            fntFText = fntLabel;
        }
        Font fntBorder = UIManager.getDefaults().getFont("TitledBorder.font");
        if (fntBorder == null) {
            fntBorder = fntLabel;
        }
        fntLabel = fntLabel.deriveFont((float) GDStashFrame.iniConfig.sectUI.fontSize);
        fntFText = fntFText.deriveFont((float) GDStashFrame.iniConfig.sectUI.fontSize);
        fntBorder = fntBorder.deriveFont((float) GDStashFrame.iniConfig.sectUI.fontSize);
        final Border lowered = BorderFactory.createEtchedBorder(1);
        final Border raised = BorderFactory.createEtchedBorder(0);
        final Border compound = BorderFactory.createCompoundBorder(raised, lowered);
        final TitledBorder text = BorderFactory.createTitledBorder(compound, GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_ACHIEVEMENTS"));
        text.setTitleFont(fntBorder);
        this.setBorder(text);
        if (this.lblGreatestDamageDealt == null) {
            this.lblGreatestDamageDealt = new JLabel();
        }
        this.lblGreatestDamageDealt.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_GREATEST_DAMAGE_DEALT"));
        this.lblGreatestDamageDealt.setFont(fntLabel);
        if (this.ftGreatestDamageDealt == null) {
            this.ftGreatestDamageDealt = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftGreatestDamageDealt.getDocument();
            doc.setDocumentFilter(filter);
            this.ftGreatestDamageDealt.setEditable(false);
        }
        this.ftGreatestDamageDealt.setPreferredSize(new Dimension(GDStashFrame.iniConfig.sectUI.fontSize * 7, GDStashFrame.iniConfig.sectUI.fontSize * 2));
        this.ftGreatestDamageDealt.setFont(fntFText);
        if (this.btnGreatestDamageDealtReset == null) {
            (this.btnGreatestDamageDealtReset = new JButton()).addActionListener(new ResetGreatestDamageDealtListener());
        }
        this.btnGreatestDamageDealtReset.setIcon(GDImagePool.iconCharEditMasteryReset16);
        this.btnGreatestDamageDealtReset.setFont(fntButton);
        if (this.lblGreatestDamageTaken == null) {
            this.lblGreatestDamageTaken = new JLabel();
        }
        this.lblGreatestDamageTaken.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_GREATEST_DAMAGE_REC"));
        this.lblGreatestDamageTaken.setFont(fntLabel);
        if (this.ftGreatestDamageTaken == null) {
            this.ftGreatestDamageTaken = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftGreatestDamageTaken.getDocument();
            doc.setDocumentFilter(filter);
            this.ftGreatestDamageTaken.setEditable(false);
        }
        this.ftGreatestDamageTaken.setPreferredSize(new Dimension(GDStashFrame.iniConfig.sectUI.fontSize * 7, GDStashFrame.iniConfig.sectUI.fontSize * 2));
        this.ftGreatestDamageTaken.setFont(fntFText);
        if (this.btnGreatestDamageTakenReset == null) {
            (this.btnGreatestDamageTakenReset = new JButton()).addActionListener(new ResetGreatestDamageTakenListener());
        }
        this.btnGreatestDamageTakenReset.setIcon(GDImagePool.iconCharEditMasteryReset16);
        this.btnGreatestDamageTakenReset.setFont(fntButton);
        if (this.lblMonstersKilled == null) {
            this.lblMonstersKilled = new JLabel();
        }
        this.lblMonstersKilled.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_KILLED_MONSTER"));
        this.lblMonstersKilled.setFont(fntLabel);
        if (this.ftMonstersKilled == null) {
            this.ftMonstersKilled = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftMonstersKilled.getDocument();
            doc.setDocumentFilter(filter);
            this.ftMonstersKilled.setEditable(false);
        }
        this.ftMonstersKilled.setFont(fntFText);
        if (this.lblHeroesKilled == null) {
            this.lblHeroesKilled = new JLabel();
        }
        this.lblHeroesKilled.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_KILLED_HERO"));
        this.lblHeroesKilled.setFont(fntLabel);
        if (this.ftHeroesKilled == null) {
            this.ftHeroesKilled = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftHeroesKilled.getDocument();
            doc.setDocumentFilter(filter);
            this.ftHeroesKilled.setEditable(false);
        }
        this.ftHeroesKilled.setFont(fntFText);
        if (this.lblNemesisKilled == null) {
            this.lblNemesisKilled = new JLabel();
        }
        this.lblNemesisKilled.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_KILLED_NEMESIS"));
        this.lblNemesisKilled.setFont(fntLabel);
        if (this.ftNemesisKilled == null) {
            this.ftNemesisKilled = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftNemesisKilled.getDocument();
            doc.setDocumentFilter(filter);
            this.ftNemesisKilled.setEditable(false);
        }
        this.ftNemesisKilled.setFont(fntFText);
        if (this.lblNotesCollected == null) {
            this.lblNotesCollected = new JLabel();
        }
        this.lblNotesCollected.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_FOUND_NOTES"));
        this.lblNotesCollected.setFont(fntLabel);
        if (this.ftNotesCollected == null) {
            this.ftNotesCollected = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftNotesCollected.getDocument();
            doc.setDocumentFilter(filter);
            this.ftNotesCollected.setEditable(false);
        }
        this.ftNotesCollected.setFont(fntFText);
        if (this.lblOneshotsOpened == null) {
            this.lblOneshotsOpened = new JLabel();
        }
        this.lblOneshotsOpened.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_FOUND_CHESTS"));
        this.lblOneshotsOpened.setFont(fntLabel);
        if (this.ftOneshotsOpened == null) {
            this.ftOneshotsOpened = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftOneshotsOpened.getDocument();
            doc.setDocumentFilter(filter);
            this.ftOneshotsOpened.setEditable(false);
        }
        this.ftOneshotsOpened.setFont(fntFText);
        if (this.lblPlayTime == null) {
            this.lblPlayTime = new JLabel();
        }
        this.lblPlayTime.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_PLAY_TIME"));
        this.lblPlayTime.setFont(fntLabel);
        if (this.ftPlayTime == null) {
            (this.ftPlayTime = new JFormattedTextField()).setEditable(false);
        }
        this.ftPlayTime.setFont(fntFText);
        if (this.lblItemsCrafted == null) {
            this.lblItemsCrafted = new JLabel();
        }
        this.lblItemsCrafted.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_CRAFTED_ITEMS"));
        this.lblItemsCrafted.setFont(fntLabel);
        if (this.ftItemsCrafted == null) {
            this.ftItemsCrafted = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftItemsCrafted.getDocument();
            doc.setDocumentFilter(filter);
            this.ftItemsCrafted.setEditable(false);
        }
        this.ftItemsCrafted.setPreferredSize(new Dimension(GDStashFrame.iniConfig.sectUI.fontSize * 7, GDStashFrame.iniConfig.sectUI.fontSize * 2));
        this.ftItemsCrafted.setFont(fntFText);
        if (this.lblRelicsCrafted == null) {
            this.lblRelicsCrafted = new JLabel();
        }
        this.lblRelicsCrafted.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_CRAFTED_RELICS"));
        this.lblRelicsCrafted.setFont(fntLabel);
        if (this.ftRelicsCrafted == null) {
            this.ftRelicsCrafted = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftRelicsCrafted.getDocument();
            doc.setDocumentFilter(filter);
            this.ftRelicsCrafted.setEditable(false);
        }
        this.ftRelicsCrafted.setFont(fntFText);
        if (this.lblRelicsTransCrafted == null) {
            this.lblRelicsTransCrafted = new JLabel();
        }
        this.lblRelicsTransCrafted.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_CRAFTED_RELICS_TRANS"));
        this.lblRelicsTransCrafted.setFont(fntLabel);
        if (this.ftRelicsTransCrafted == null) {
            this.ftRelicsTransCrafted = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftRelicsTransCrafted.getDocument();
            doc.setDocumentFilter(filter);
            this.ftRelicsTransCrafted.setEditable(false);
        }
        this.ftRelicsTransCrafted.setFont(fntFText);
        if (this.lblRelicsMythicalCrafted == null) {
            this.lblRelicsMythicalCrafted = new JLabel();
        }
        this.lblRelicsMythicalCrafted.setText(GDMsgFormatter.getString(GDMsgFormatter.rbGD, "TXT_CHAR_CRAFTED_RELICS_MYTH"));
        this.lblRelicsMythicalCrafted.setFont(fntLabel);
        if (this.ftRelicsMythicalCrafted == null) {
            this.ftRelicsMythicalCrafted = new JFormattedTextField();
            final DocumentFilter filter = new IntLenDocFilter(7);
            final AbstractDocument doc = (AbstractDocument) this.ftRelicsMythicalCrafted.getDocument();
            doc.setDocumentFilter(filter);
            this.ftRelicsMythicalCrafted.setEditable(false);
        }
        this.ftRelicsMythicalCrafted.setFont(fntFText);
    }

    private JPanel buildLeftSidePanel() {
        final JPanel panel = new JPanel();
        GroupLayout layout = null;
        GroupLayout.SequentialGroup hGroup = null;
        GroupLayout.SequentialGroup vGroup = null;
        layout = new GroupLayout(panel);
        panel.setLayout(layout);
        layout.setAutoCreateGaps(true);
        layout.setAutoCreateContainerGaps(true);
        hGroup = layout.createSequentialGroup();
        hGroup.addGroup(layout.createParallelGroup().addComponent(this.lblGreatestDamageDealt).addComponent(this.lblGreatestDamageTaken).addComponent(this.lblMonstersKilled).addComponent(this.lblHeroesKilled).addComponent(this.lblNemesisKilled).addComponent(this.lblNotesCollected).addComponent(this.lblOneshotsOpened)).addGroup(layout.createParallelGroup().addComponent(this.ftGreatestDamageDealt).addComponent(this.ftGreatestDamageTaken).addComponent(this.ftMonstersKilled).addComponent(this.ftHeroesKilled).addComponent(this.ftNemesisKilled).addComponent(this.ftNotesCollected).addComponent(this.ftOneshotsOpened)).addGroup(layout.createParallelGroup().addComponent(this.btnGreatestDamageDealtReset).addComponent(this.btnGreatestDamageTakenReset));
        layout.setHorizontalGroup(hGroup);
        vGroup = layout.createSequentialGroup();
        vGroup.addGroup(layout.createParallelGroup().addComponent(this.lblGreatestDamageDealt).addComponent(this.ftGreatestDamageDealt).addComponent(this.btnGreatestDamageDealtReset)).addGroup(layout.createParallelGroup().addComponent(this.lblGreatestDamageTaken).addComponent(this.ftGreatestDamageTaken).addComponent(this.btnGreatestDamageTakenReset)).addGroup(layout.createParallelGroup().addComponent(this.lblMonstersKilled).addComponent(this.ftMonstersKilled)).addGroup(layout.createParallelGroup().addComponent(this.lblHeroesKilled).addComponent(this.ftHeroesKilled)).addGroup(layout.createParallelGroup().addComponent(this.lblNemesisKilled).addComponent(this.ftNemesisKilled)).addGroup(layout.createParallelGroup().addComponent(this.lblNotesCollected).addComponent(this.ftNotesCollected)).addGroup(layout.createParallelGroup().addComponent(this.lblOneshotsOpened).addComponent(this.ftOneshotsOpened));
        layout.setVerticalGroup(vGroup);
        layout.linkSize(0, this.lblGreatestDamageDealt, this.lblGreatestDamageTaken);
        layout.linkSize(0, this.lblGreatestDamageDealt, this.lblMonstersKilled);
        layout.linkSize(0, this.lblGreatestDamageDealt, this.lblHeroesKilled);
        layout.linkSize(0, this.lblGreatestDamageDealt, this.lblNemesisKilled);
        layout.linkSize(0, this.lblGreatestDamageDealt, this.lblNotesCollected);
        layout.linkSize(0, this.lblGreatestDamageDealt, this.lblOneshotsOpened);
        layout.linkSize(0, this.ftGreatestDamageDealt, this.ftGreatestDamageTaken);
        layout.linkSize(0, this.ftGreatestDamageDealt, this.ftMonstersKilled);
        layout.linkSize(0, this.ftGreatestDamageDealt, this.ftHeroesKilled);
        layout.linkSize(0, this.ftGreatestDamageDealt, this.ftNemesisKilled);
        layout.linkSize(0, this.ftGreatestDamageDealt, this.ftNotesCollected);
        layout.linkSize(0, this.ftGreatestDamageDealt, this.ftOneshotsOpened);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.lblGreatestDamageTaken);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.lblMonstersKilled);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.lblHeroesKilled);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.lblNemesisKilled);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.lblNotesCollected);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.lblOneshotsOpened);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftGreatestDamageTaken);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftGreatestDamageDealt);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftMonstersKilled);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftHeroesKilled);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftNemesisKilled);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftNotesCollected);
        layout.linkSize(1, this.lblGreatestDamageDealt, this.ftOneshotsOpened);
        return panel;
    }

    private JPanel buildRightSidePanel() {
        final JPanel panel = new JPanel();
        GroupLayout layout = null;
        GroupLayout.SequentialGroup hGroup = null;
        GroupLayout.SequentialGroup vGroup = null;
        layout = new GroupLayout(panel);
        panel.setLayout(layout);
        layout.setAutoCreateGaps(true);
        layout.setAutoCreateContainerGaps(true);
        hGroup = layout.createSequentialGroup();
        hGroup.addGroup(layout.createParallelGroup().addComponent(this.lblPlayTime).addComponent(this.lblItemsCrafted).addComponent(this.lblRelicsCrafted).addComponent(this.lblRelicsTransCrafted).addComponent(this.lblRelicsMythicalCrafted)).addGroup(layout.createParallelGroup().addComponent(this.ftPlayTime).addComponent(this.ftItemsCrafted).addComponent(this.ftRelicsCrafted).addComponent(this.ftRelicsTransCrafted).addComponent(this.ftRelicsMythicalCrafted));
        layout.setHorizontalGroup(hGroup);
        vGroup = layout.createSequentialGroup();
        vGroup.addGroup(layout.createParallelGroup().addComponent(this.lblPlayTime).addComponent(this.ftPlayTime)).addGroup(layout.createParallelGroup().addComponent(this.lblItemsCrafted).addComponent(this.ftItemsCrafted)).addGroup(layout.createParallelGroup().addComponent(this.lblRelicsCrafted).addComponent(this.ftRelicsCrafted)).addGroup(layout.createParallelGroup().addComponent(this.lblRelicsTransCrafted).addComponent(this.ftRelicsTransCrafted)).addGroup(layout.createParallelGroup().addComponent(this.lblRelicsMythicalCrafted).addComponent(this.ftRelicsMythicalCrafted));
        layout.setVerticalGroup(vGroup);
        layout.linkSize(0, this.lblItemsCrafted, this.lblPlayTime);
        layout.linkSize(0, this.lblItemsCrafted, this.lblRelicsCrafted);
        layout.linkSize(0, this.lblItemsCrafted, this.lblRelicsTransCrafted);
        layout.linkSize(0, this.lblItemsCrafted, this.lblRelicsMythicalCrafted);
        layout.linkSize(0, this.ftItemsCrafted, this.ftPlayTime);
        layout.linkSize(0, this.ftItemsCrafted, this.ftRelicsCrafted);
        layout.linkSize(0, this.ftItemsCrafted, this.ftRelicsTransCrafted);
        layout.linkSize(0, this.ftItemsCrafted, this.ftRelicsMythicalCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.lblPlayTime);
        layout.linkSize(1, this.lblItemsCrafted, this.lblRelicsCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.lblRelicsTransCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.lblRelicsMythicalCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.ftPlayTime);
        layout.linkSize(1, this.lblItemsCrafted, this.ftItemsCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.ftRelicsCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.ftRelicsTransCrafted);
        layout.linkSize(1, this.lblItemsCrafted, this.ftRelicsMythicalCrafted);
        return panel;
    }

    public void setChar(final GDChar gdc) {
        this.gdc = gdc;
        int greatestDamageDealt = 0;
        int greatestDamageReceived = 0;
        int killsMonster = 0;
        int killsHero = 0;
        int killsNemesis = 0;
        int foundNotes = 0;
        int foundOneShot = 0;
        String playTime = "";
        int craftItems = 0;
        int craftRelic = 0;
        int craftRelicTrans = 0;
        int craftRelicMyth = 0;
        if (gdc != null) {
            greatestDamageDealt = gdc.getGreatestDamageInflicted();
            greatestDamageReceived = gdc.getGreatestDamageReceived();
            killsMonster = gdc.getKillsMonster();
            killsHero = gdc.getKillsHero();
            killsNemesis = gdc.getKillsNemesis();
            foundNotes = gdc.getLoreNotesCollected();
            foundOneShot = gdc.getOneShotChestsOpened();
            playTime = gdc.getPlayTimeAsDHM();
            craftItems = gdc.getItemsCrafted();
            craftRelic = gdc.getRelicsCrafted();
            craftRelicTrans = gdc.getRelicsTranscendentCrafted();
            craftRelicMyth = gdc.getRelicsMythicalCrafted();
        }
        this.ftGreatestDamageDealt.setText(Integer.toString(greatestDamageDealt));
        this.ftGreatestDamageTaken.setText(Integer.toString(greatestDamageReceived));
        this.ftMonstersKilled.setText(Integer.toString(killsMonster));
        this.ftHeroesKilled.setText(Integer.toString(killsHero));
        this.ftNemesisKilled.setText(Integer.toString(killsNemesis));
        this.ftNotesCollected.setText(Integer.toString(foundNotes));
        this.ftOneshotsOpened.setText(Integer.toString(foundOneShot));
        this.ftPlayTime.setText(playTime);
        this.ftItemsCrafted.setText(Integer.toString(craftItems));
        this.ftRelicsCrafted.setText(Integer.toString(craftRelic));
        this.ftRelicsTransCrafted.setText(Integer.toString(craftRelicTrans));
        this.ftRelicsMythicalCrafted.setText(Integer.toString(craftRelicMyth));
    }

    public void updateChar(final GDChar gdc) {
        if (gdc == null) {
            return;
        }
        gdc.setGreatestDamageInflicted((float) Integer.parseInt(this.ftGreatestDamageDealt.getText()));
        gdc.setGreatestDamageReceived((float) Integer.parseInt(this.ftGreatestDamageTaken.getText()));
    }

    private class ResetGreatestDamageDealtListener implements ActionListener {
        private int index;

        @Override
        public void actionPerformed(final ActionEvent ev) {
            if (GDCharStatAchievementPane.this.gdc == null) {
                return;
            }
            GDCharStatAchievementPane.this.ftGreatestDamageDealt.setText("0");
        }
    }

    private class ResetGreatestDamageTakenListener implements ActionListener {
        private int index;

        @Override
        public void actionPerformed(final ActionEvent ev) {
            if (GDCharStatAchievementPane.this.gdc == null) {
                return;
            }
            GDCharStatAchievementPane.this.ftGreatestDamageTaken.setText("0");
        }
    }
}
